﻿using System;
using System.IO;
using SEXY;
using UnityEngine;

namespace Character
{
	// Token: 0x020001AC RID: 428
	public class BodyParameter : ParameterBase
	{
		// Token: 0x06000B0B RID: 2827 RVA: 0x0003FDDC File Offset: 0x0003DFDC
		public BodyParameter(SEX sex) : base(sex)
		{
			int num = (sex != SEX.FEMALE) ? CharDefine.cf_bodyshapename.Length : CharDefine.cf_bodyshapename.Length;
			this.shapeVals = new float[num];
			for (int i = 0; i < this.shapeVals.Length; i++)
			{
				this.shapeVals[i] = 0.5f;
			}
			if (sex == SEX.FEMALE)
			{
				this.shapeVals[this.shapeVals.Length - 1] = 0f;
			}
		}

		// Token: 0x06000B0C RID: 2828 RVA: 0x0003FEE4 File Offset: 0x0003E0E4
		public BodyParameter(BodyParameter copy) : base(copy.sex)
		{
			this.Copy(copy);
		}

		// Token: 0x06000B0D RID: 2829 RVA: 0x0003FF90 File Offset: 0x0003E190
		public void Init()
		{
			this.bodyID = 0;
			this.skinColor = new ColorParameter_AlloyHSVOffset();
			this.detailID = 0;
			this.detailWeight = 0f;
			this.underhairID = 0;
			this.underhairColor = new ColorParameter_Alloy();
			this.tattooID = 0;
			this.tattooColor = Color.white;
			this.nailColor = new ColorParameter_AlloyHSVOffset();
			this.manicureColor = new ColorParameter_PBR1();
			this.manicureColor.mainColor1.a = 0f;
			this.areolaSize = 0.5f;
			this.bustSoftness = 0.5f;
			this.bustWeight = 0.5f;
			if (this.shapeVals != null)
			{
				for (int i = 0; i < this.shapeVals.Length; i++)
				{
					this.shapeVals[i] = 0.5f;
				}
			}
			this.nipID = 0;
			this.nipColor = new ColorParameter_AlloyHSVOffset(true, 1f);
			this.sunburnID = 0;
			this.sunburnColor_H = 0f;
			this.sunburnColor_S = 1f;
			this.sunburnColor_V = 1f;
			this.sunburnColor_A = 1f;
		}

		// Token: 0x06000B0E RID: 2830 RVA: 0x000400B0 File Offset: 0x0003E2B0
		public void Copy(BodyParameter copy)
		{
			if (this.shapeVals == null || this.shapeVals.Length != copy.shapeVals.Length)
			{
				this.shapeVals = new float[copy.shapeVals.Length];
			}
			Array.Copy(copy.shapeVals, this.shapeVals, this.shapeVals.Length);
			this.bodyID = copy.bodyID;
			this.skinColor = new ColorParameter_AlloyHSVOffset(copy.skinColor);
			this.detailID = copy.detailID;
			this.detailWeight = copy.detailWeight;
			this.underhairID = copy.underhairID;
			this.underhairColor = new ColorParameter_Alloy(copy.underhairColor);
			this.tattooID = copy.tattooID;
			this.tattooColor = copy.tattooColor;
			this.nipID = copy.nipID;
			this.nipColor = new ColorParameter_AlloyHSVOffset(copy.nipColor);
			this.sunburnID = copy.sunburnID;
			this.sunburnColor_H = copy.sunburnColor_H;
			this.sunburnColor_S = copy.sunburnColor_S;
			this.sunburnColor_V = copy.sunburnColor_V;
			this.sunburnColor_A = copy.sunburnColor_A;
			this.nailColor = new ColorParameter_AlloyHSVOffset(copy.nailColor);
			this.manicureColor = new ColorParameter_PBR1(copy.manicureColor);
			this.areolaSize = copy.areolaSize;
			this.bustSoftness = copy.bustSoftness;
			this.bustWeight = copy.bustWeight;
		}

		// Token: 0x06000B0F RID: 2831 RVA: 0x00040214 File Offset: 0x0003E414
		public float GetHeight()
		{
			return (this.sex != SEX.FEMALE) ? 1f : this.shapeVals[0];
		}

		// Token: 0x06000B10 RID: 2832 RVA: 0x00040234 File Offset: 0x0003E434
		public float GetBustSize()
		{
			return (this.sex != SEX.FEMALE) ? 0f : this.shapeVals[1];
		}

		// Token: 0x06000B11 RID: 2833 RVA: 0x00040254 File Offset: 0x0003E454
		public void Save(BinaryWriter writer, SEX sex)
		{
			base.Write(writer, this.bodyID);
			this.skinColor.Save(writer);
			base.Write(writer, this.detailID);
			base.Write(writer, this.detailWeight);
			base.Write(writer, this.underhairID);
			this.underhairColor.Save(writer);
			base.Write(writer, this.tattooID);
			base.Write(writer, this.tattooColor);
			base.Write(writer, this.shapeVals);
			if (sex == SEX.FEMALE)
			{
				base.Write(writer, this.nipID);
				this.nipColor.Save(writer);
				base.Write(writer, this.sunburnID);
				base.Write(writer, this.sunburnColor_H);
				base.Write(writer, this.sunburnColor_S);
				base.Write(writer, this.sunburnColor_V);
				base.Write(writer, this.sunburnColor_A);
				this.nailColor.Save(writer);
				this.manicureColor.Save(writer);
				base.Write(writer, this.areolaSize);
				base.Write(writer, this.bustSoftness);
				base.Write(writer, this.bustWeight);
			}
		}

		// Token: 0x06000B12 RID: 2834 RVA: 0x00040374 File Offset: 0x0003E574
		public void Load(BinaryReader reader, SEX sex, CUSTOM_DATA_VERSION version)
		{
			base.Read(reader, ref this.bodyID);
			this.skinColor.Load(reader, version);
			base.Read(reader, ref this.detailID);
			base.Read(reader, ref this.detailWeight);
			base.Read(reader, ref this.underhairID);
			this.underhairColor.Load(reader, version);
			base.Read(reader, ref this.tattooID);
			base.Read(reader, ref this.tattooColor);
			base.Read(reader, ref this.shapeVals);
			if (sex == SEX.FEMALE)
			{
				base.Read(reader, ref this.nipID);
				this.nipColor.Load(reader, version);
				base.Read(reader, ref this.sunburnID);
				if (version < CUSTOM_DATA_VERSION.DEBUG_06)
				{
					Color white = Color.white;
					base.Read(reader, ref white);
					this.sunburnColor_H = 0f;
					this.sunburnColor_S = 1f;
					this.sunburnColor_V = 1f;
					this.sunburnColor_A = 1f;
				}
				else
				{
					base.Read(reader, ref this.sunburnColor_H);
					base.Read(reader, ref this.sunburnColor_S);
					base.Read(reader, ref this.sunburnColor_V);
					base.Read(reader, ref this.sunburnColor_A);
				}
				if (version < CUSTOM_DATA_VERSION.DEBUG_03)
				{
					return;
				}
				this.nailColor.Load(reader, version);
				if (version >= CUSTOM_DATA_VERSION.DEBUG_09)
				{
					this.manicureColor.Load(reader, version);
				}
				else
				{
					this.manicureColor.mainColor1 = Color.white;
					this.manicureColor.mainColor1.a = 0f;
					this.manicureColor.specColor1 = Color.white;
					this.manicureColor.specular1 = 0f;
					this.manicureColor.smooth1 = 0f;
				}
				base.Read(reader, ref this.areolaSize);
				base.Read(reader, ref this.bustSoftness);
				base.Read(reader, ref this.bustWeight);
			}
		}

		// Token: 0x04000B73 RID: 2931
		public int bodyID;

		// Token: 0x04000B74 RID: 2932
		public ColorParameter_AlloyHSVOffset skinColor = new ColorParameter_AlloyHSVOffset();

		// Token: 0x04000B75 RID: 2933
		public int detailID;

		// Token: 0x04000B76 RID: 2934
		public float detailWeight;

		// Token: 0x04000B77 RID: 2935
		public int underhairID;

		// Token: 0x04000B78 RID: 2936
		public ColorParameter_Alloy underhairColor = new ColorParameter_Alloy();

		// Token: 0x04000B79 RID: 2937
		public int tattooID;

		// Token: 0x04000B7A RID: 2938
		public Color tattooColor = Color.white;

		// Token: 0x04000B7B RID: 2939
		public float[] shapeVals;

		// Token: 0x04000B7C RID: 2940
		public int nipID;

		// Token: 0x04000B7D RID: 2941
		public ColorParameter_AlloyHSVOffset nipColor = new ColorParameter_AlloyHSVOffset(true, 1f);

		// Token: 0x04000B7E RID: 2942
		public int sunburnID;

		// Token: 0x04000B7F RID: 2943
		public float sunburnColor_H;

		// Token: 0x04000B80 RID: 2944
		public float sunburnColor_S = 1f;

		// Token: 0x04000B81 RID: 2945
		public float sunburnColor_V = 1f;

		// Token: 0x04000B82 RID: 2946
		public float sunburnColor_A = 1f;

		// Token: 0x04000B83 RID: 2947
		public ColorParameter_AlloyHSVOffset nailColor = new ColorParameter_AlloyHSVOffset();

		// Token: 0x04000B84 RID: 2948
		public ColorParameter_PBR1 manicureColor = new ColorParameter_PBR1();

		// Token: 0x04000B85 RID: 2949
		public float areolaSize = 0.7f;

		// Token: 0x04000B86 RID: 2950
		public float bustSoftness = 0.5f;

		// Token: 0x04000B87 RID: 2951
		public float bustWeight = 0.5f;
	}
}
